import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/transfer_user_entity.dart';

TransferUserEntity $TransferUserEntityFromJson(Map<String, dynamic> json) {
  final TransferUserEntity transferUserEntity = TransferUserEntity();
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    transferUserEntity.uid = uid;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    transferUserEntity.mobile = mobile;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    transferUserEntity.name = name;
  }
  final String? userType = jsonConvert.convert<String>(json['userType']);
  if (userType != null) {
    transferUserEntity.userType = userType;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    transferUserEntity.email = email;
  }
  final int? activated = jsonConvert.convert<int>(json['activated']);
  if (activated != null) {
    transferUserEntity.activated = activated;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    transferUserEntity.avatar = avatar;
  }
  final String? owner = jsonConvert.convert<String>(json['owner']);
  if (owner != null) {
    transferUserEntity.owner = owner;
  }
  final int? capability = jsonConvert.convert<int>(json['capability']);
  if (capability != null) {
    transferUserEntity.capability = capability;
  }
  final int? lastLoginDate = jsonConvert.convert<int>(json['lastLoginDate']);
  if (lastLoginDate != null) {
    transferUserEntity.lastLoginDate = lastLoginDate;
  }
  final String? referrer = jsonConvert.convert<String>(json['referrer']);
  if (referrer != null) {
    transferUserEntity.referrer = referrer;
  }
  final int? referrerAt = jsonConvert.convert<int>(json['referrerAt']);
  if (referrerAt != null) {
    transferUserEntity.referrerAt = referrerAt;
  }
  final String? registerDate = jsonConvert.convert<String>(
      json['registerDate']);
  if (registerDate != null) {
    transferUserEntity.registerDate = registerDate;
  }
  final String? role = jsonConvert.convert<String>(json['role']);
  if (role != null) {
    transferUserEntity.role = role;
  }
  return transferUserEntity;
}

Map<String, dynamic> $TransferUserEntityToJson(TransferUserEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['uid'] = entity.uid;
  data['mobile'] = entity.mobile;
  data['name'] = entity.name;
  data['userType'] = entity.userType;
  data['email'] = entity.email;
  data['activated'] = entity.activated;
  data['avatar'] = entity.avatar;
  data['owner'] = entity.owner;
  data['capability'] = entity.capability;
  data['lastLoginDate'] = entity.lastLoginDate;
  data['referrer'] = entity.referrer;
  data['referrerAt'] = entity.referrerAt;
  data['registerDate'] = entity.registerDate;
  data['role'] = entity.role;
  return data;
}

extension TransferUserEntityExtension on TransferUserEntity {
  TransferUserEntity copyWith({
    String? uid,
    String? mobile,
    String? name,
    String? userType,
    String? email,
    int? activated,
    String? avatar,
    String? owner,
    int? capability,
    int? lastLoginDate,
    String? referrer,
    int? referrerAt,
    String? registerDate,
    String? role,
  }) {
    return TransferUserEntity()
      ..uid = uid ?? this.uid
      ..mobile = mobile ?? this.mobile
      ..name = name ?? this.name
      ..userType = userType ?? this.userType
      ..email = email ?? this.email
      ..activated = activated ?? this.activated
      ..avatar = avatar ?? this.avatar
      ..owner = owner ?? this.owner
      ..capability = capability ?? this.capability
      ..lastLoginDate = lastLoginDate ?? this.lastLoginDate
      ..referrer = referrer ?? this.referrer
      ..referrerAt = referrerAt ?? this.referrerAt
      ..registerDate = registerDate ?? this.registerDate
      ..role = role ?? this.role;
  }
}